﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace ConsoleApplication1
    {
    
    class TP1
    {
        static void Main(string[] args)
        {
            TP1 tp1 = new TP1();
            tp1.EstPalindrome();
            //tp1.Saisi();
        }

        public void EstPalindrome()
        {
            string contenu = Console.ReadLine();
            
            while (contenu != "quit")
            {
                bool palindrome = Palindrome(contenu);
                if (palindrome)
                    Console.Write("C'est un paindrome\n");
                else
                    Console.Write("Et non, try again\n");
                contenu = Console.ReadLine();
            }
        }

        public bool Palindrome(string str)
        {
            string strSansEspace = "";
            foreach (char c in str)
            {
                if (c != ' ')
                {
                    strSansEspace += c;
                }
            }

            int i = strSansEspace.Length;
            char[] strInverse = new char[i];
            foreach (char c in strSansEspace)
            {
                i--;
                if (c != ' ')
                {
                    strInverse[i] = c;
                }
            }
            string strInv = "";
            for (int j = 0; j < strInverse.Length; j++)
            {
                strInv += strInverse[j];
            }
            return strSansEspace.Equals(strInv);
        }

        public void Saisi()
        {
            string contenu = Console.ReadLine();
            while (contenu != "quit")
            {
                string[] contenus = contenu.Split();
                if (contenus.Length != 3)
                    Console.Write("Entree non valide\n");
                else
                {
                    try
                    {
                        Console.Write("{0} {1} {2} = {3}\n", contenus[0], contenus[1], contenus[2], Calcul(decimal.Parse(contenus[0]), decimal.Parse(contenus[1]), contenus[2]));
                    }
                    catch (DivideByZeroException dbzex)
                    {
                        Console.Error.WriteLine("Division par zéro");
                    }
                }
                contenu = Console.ReadLine();
            }
        }

        public decimal Calcul(decimal x, decimal y, string op )
        {
            switch(op){
                case "+" : 
                    return x + y;
                case "*":
                    return x * y;
                case "-":
                    return x - y;
                case "/":
                    return x / y;
                default :
                    return -1;
            }
        }


        /*private int unAttribut;
        public int UnAttribut
        {
            get
            {
                return unAttribut;
            }
            set
            {
                unAttribut = value;
            }
        }

        public struct dimension
        {
            public int width;
            public int height;
        }

        public void tester()
        {
            string[] noms = { "Richard", "Philippe", "Anna" };
            foreach (string nom in noms)
            {
                Console.WriteLine(nom);
            }
        }
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World !!");
            //Console.Write("Hello, {0}!", Console.ReadLine());
            TP1 tp1 = new TP1();
            tp1.tester();
        }*/


        
    }
}
